package com.koi.system.config.exceptions;/*
package com.candy.system.config.exceptions;

import com.candy.system.config.constants.HttpStatus;
import com.candy.system.vo.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

*/
/**
 * 找到返回有code 和 msg的统一返回结果即可
 * @author 大猫
 * @version 1.0
 *//*

@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {

    */
/**
     * 参数校验
     * @author 大猫
     * @date 2021/12/7 15:44
     *//*

    @ExceptionHandler(ParamsException.class)
    @ResponseBody
    public AjaxResult paramsExceptionHandler(ParamsException e){
        //e.printStackTrace();
        log.error("参数校验异常===>{}",e);
        return AjaxResult.error(HttpStatus.BAD_REQUEST, e.getMsg());
    }

    */
/**
     * 全局异常
     * @author 大猫
     * @date 2021/12/7 15:44
     *//*

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public AjaxResult exceptionHandler(Exception e){
        //e.printStackTrace();
        log.error("系统全局异常===>{}",e);
        return AjaxResult.error(HttpStatus.ERROR,"系统未知异常，请稍后重试");
    }

    */
/**
     * 未授权
     * @author 大猫
     * @date 2021/7/20 23:37
     *//*

    @ExceptionHandler(UnauthorizedException.class)
    @ResponseBody
    public Object unauthorized(UnauthorizedException e) {
        //e.printStackTrace();
        log.error("系统未授权===>{}",e);
        return AjaxResult.error(HttpStatus.UNAUTHORIZED,"未授权，请联系管理员");
*/
/*        Map<String,Object> map=new HashMap<>();
        map.put("code", -1);
        map.put("msg", "未授权，请联系管理员");
        return map;*//*

    }

    */
/**
     * shiro异常
     * @author 大猫
     * @date 2021/7/20 23:37
     *//*

    @ExceptionHandler(AuthenticationException.class)
    @ResponseBody
    public AjaxResult AuthenticationException(AuthenticationException e){
        log.error("shiro异常===>{}",e);
        //e.printStackTrace();
        return AjaxResult.error(HttpStatus.ERROR,"用户或密码不正确，请重新输入");
    }

    */
/*
      @DateTimeFormat是spring包里面的注解，作用是接收从页面传到后台的日期值；
      @JsonFormat是jackson包里面的注解，作用是从后台向前台传递日期值；
      @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GTM+8")
      @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
      @TableField(fill = FieldFill.INSERT)
      @TableField(fill = FieldFill.INSERT_UPDATE)
     *//*


}
*/
